<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Newsy</title>




<style>
body
{
background-color:#DDDDDD;	
	

}

table,th,td
{
border:1px grey; 
background-color:#CCCCCC;
}
</style>

</head>

<body>


<div align="right"><a href="newsmyadm.php">Zarządzanie newsami</a></div>

<div style="width: 917px">
<?PHP
$con=mysqli_connect("localhost","root","","bd_news");
// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}




$result = mysqli_query($con,"SELECT id_news, title, description, maintext, date, rating, id_user  FROM `news` ");



while($row = mysqli_fetch_array($result)) {
	echo '<div>';
	echo '<table>';
		echo '<td width="750">';
 			 echo "ID: ".$row['id_news'] . "<br>Tytuł: " . $row['title']. "<br>Krótki opis: " . $row['description']. "<br>Głowny tekst: " . $row['maintext']. "<br>Data dodania: " . $row['date']. "<br>Ocena: " . $row['rating']. "<br>Dodane przez: " . $row['id_user']."";
		echo '</td>';
	echo '</table>';
	echo '</div><br><br>';
}




mysqli_close($con);	
?>
<div>


</div>


</body>

</html>
